package com.hlhj.carview.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.hlhj.carview.Iview.EquipmentDetailView
import com.hlhj.carview.bean.EquipmentDetailBean
import com.hlhj.carview.http.Apis
import com.hlhj.carview.http.CustomAction
import com.hlhj.carview.http.LoadingAction
import com.lzy.okgo.model.Response

/**
 * Created by Never Fear   on 2018\12\21 0021.
Never More....
 */
class EquipmenDetailtModule :BaseModule {
    var lis:EquipmentDetailView?=null
    fun getDetail(did:Int,c:Context){
        Apis?.getEquipmentDetail(did)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<EquipmentDetailBean>>(c){
                                override fun httpSuccess(t: Response<EquipmentDetailBean>) {
                                    lis?.setDetail(t.body())
                                }
                            })
                }
    }
}